home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / _GUICtrlStatusBarCreateProgress.au3 < prev    next >
Text File  |  2007-09-08  |  2KB  |  57 lines

  1. Opt("MustDeclareVars", 1)
  2.  
  3. #include <GUIConstants.au3>
  4. #Include <GuiStatusBar.au3>
  5.  
  6. ;~ DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0) ; turn off XP themes
  7.  
  8. Local $gui, $StatusBar1, $msg, $ProgressBar1, $ProgressBar2, $iProgress = 0, $button
  9. Local $i, $s, $m, $wait
  10. Local $a_PartsRightEdge[4] = [100, 220, 360, -1]
  11. Local $a_PartsText[4] = ["", "" ,"", ""]
  12.  
  13. $gui = GUICreate("Status Bar Create", 500, -1, -1, -1, $WS_SIZEBOX)
  14. $button = GUICtrlCreateButton ("Start",75,70,70,20)
  15. $StatusBar1 = _GUICtrlStatusBarCreate($gui, $a_PartsRightEdge, $a_PartsText)
  16. $ProgressBar1 = _GUICtrlStatusBarCreateProgress($StatusBar1, 1, $PBS_SMOOTH)
  17. $ProgressBar2 = _GUICtrlStatusBarCreateProgress($StatusBar1, 2)
  18. GUICtrlSetColor($ProgressBar1,32250)
  19. GUISetState(@SW_SHOW)
  20.  
  21. $wait = 20; wait 20ms for next progressstep
  22. $s = 0; progressbar-saveposition
  23.  
  24. While 1
  25.     $msg = GUIGetMsg()
  26.     Select
  27.         Case $msg = $GUI_EVENT_RESIZED
  28.             _GUICtrlStatusBarResize($StatusBar1)
  29.         Case $msg = $GUI_EVENT_CLOSE
  30.             ExitLoop
  31.         Case $msg = $button
  32.             GUICtrlSetData ($button,"Stop")
  33.             For $i = $s To 100
  34.  
  35.                 If GUICtrlRead($ProgressBar1) = 50 Then _GUICtrlStatusBarSetText($StatusBar1,"The half is done...")
  36.                 If GUICtrlRead($ProgressBar2) = 50 Then _GUICtrlStatusBarSetText($StatusBar1,"The half is done...",3)
  37.                 $m = GUIGetMsg ()
  38.     
  39.                 If $m = -3 Then ExitLoop
  40.     
  41.                 If $m = $button Then
  42.                     GUICtrlSetData ($button,"Next")
  43.                     $s = $i;save the current bar-position to $s
  44.                     ExitLoop
  45.                 Else
  46.                     $s=0
  47.                     GUICtrlSetData ($ProgressBar1,$i)
  48.                     GUICtrlSetData ($ProgressBar2,$i)
  49.                     Sleep($wait)
  50.                 EndIf
  51.             Next
  52.         if $i >100 Then GUICtrlSetData ($button,"Start")
  53.  
  54.     EndSelect
  55.     
  56. WEnd
  57.